class Input < ActiveRecord::Base
  set_primary_key :input_id
  has_many :messages
  has_many :user_modules
  has_many :user_output_modules
  has_attached_file :code, :path => ":rails_root/public/uploads/modules/input/:basename.:extension"
  validates_presence_of :name

  def before_destroy
    user_modules.each do |u|
      u.destroy
    end
  end
end
